//
//  SISSEntrustContractShowViewController.m
//  SISSAPP
//
//  Created by 袁应荣 on 2019/7/10.
//  Copyright © 2019 优房网. All rights reserved.
//

#import "SISSEntrustContractShowViewController.h"
#import "SISSUploadEntrustContractViewController.h"
#import "SISSNetworkingManager+Progress.h"


@interface SISSEntrustContractShowViewController ()

/// 委托合同模型
@property (strong, nonatomic) SISSEntrustContractModel *entrustContractModel;

@end

@implementation SISSEntrustContractShowViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    if (self.popBackClassType == SISSProgressPopBackClassTypeHouse) {
        self.title = @"委托合同详情";
    } else if (self.popBackClassType == SISSProgressPopBackClassTypePassenger) {
        self.title = @"买方委托合同详情";
    } else if (self.popBackClassType == SISSProgressPopBackClassTypeRentOut) {
        self.title = @"物业租赁出租方委托协议详情";
//        self.contractNoView.leftStr = @"*协议编号";
//        self.contractNoView.rightPlaceStr = @"请输入协议编号";
//        self.contractDateChooseView.leftStr = @"*协议截止日期";
//        self.contractDateChooseView.rightPlaceStr = @"请选择协议截止日期";
//        self.uploadImageView.titleStr = @"协议信息";
    } else if (self.popBackClassType == SISSProgressPopBackClassTypeTenant) {
        self.title = @"物业租赁承租方委托协议详情";
    }
    
    [self requestEntrustContractData];
}

- (void)setEntrustContractModel:(SISSEntrustContractModel *)entrustContractModel {
    _entrustContractModel = entrustContractModel;
    
    self.contractNoView.rightStr = entrustContractModel.contractNum;
    self.contractEndDateView.rightStr = [NSDate yyr_stringToString:entrustContractModel.endTime];
    self.remarkView.rightStr = entrustContractModel.otherdesc;
    self.createDateView.rightStr = entrustContractModel.insertTime;
    self.uploadImageShowView.imageUrlArr = entrustContractModel.image.mutableCopy;
}

- (void)requestEntrustContractData {
    WeakSelf
    [kNetworkManager requestProgressEntrustContractWithAbpId:self.abpId success:^(SISSEntrustContractModel *entrustContractModel) {
        
        weakSelf.entrustContractModel = entrustContractModel;
        
    } failed:^(NSError *error) {
        NSLog(@"%@",error);
    }];
    
}

- (void)modifyButtonClickAction {
    SISSUploadEntrustContractViewController *vc = [[SISSUploadEntrustContractViewController alloc] init];
    vc.abpId = self.abpId;
    vc.popBackClassType = self.popBackClassType;
    vc.entrustContractModel = self.entrustContractModel;
    [self.navigationController pushViewController:vc animated:YES];
}

@end
